<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<%@ page session="false" %>

<div class="container-breadcrumb">
    <div class="row ">
        <div class="col-sm-12">
            <ol class="breadcrumb">
                <li><a href="${pageContext.request.contextPath}/"><span class="glyphicon glyphicon-home"></span></a></li>
                <li class="active"><s:message code="menu.catalogue-categories" text="product"/></li>
            </ol>
        </div>
    </div><!--/.row-->
</div>

<c:set var="create" value="${pageContext.request.contextPath}/categories/createCategory" />
<div id="container-content" class="container-content">
    <div class="panel panel-default">
        <div class="panel-heading">
            一级分类列表
            <div class="panel-control">
                <a href="${create}?lv=1" class="btn btn-sm btn-mw btn-success">创建一级分类</a>
                <a href="${create}?lv=2" class="btn btn-sm btn-mw btn-success">创建二级分类</a>
            </div>
        </div>
        <div class="panel-body">
            <form method="get" class="row products-condition">

                <div class="form-inline col-sm-12">
                    <div class="form-group">
                        <label>商品状态</label>
                        <select  name="status" class="form-control">
                            <option value="-1" label="全部"></option>
                            <c:forEach items="${categoryStatus}" var="cs">
                                <option value="${cs}" ${(status != '-1' && status == cs) ? 'selected' : ''} label="${cs.value}"></option>
                            </c:forEach>
                        </select>
                    </div>

                    <div class="form-group">
                        <button type="submit" class="btn btn-default">查询</button>
                    </div>
                </div>
            </form>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="80">一级分类</th>
                    <th width="300">二级分类</th>
                    <th width="100">编码</th>
                    <th >热度</th>
                    <th >状态</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${categoryList}" var="item">
                    <tr>
                        <td>${item.name}</td>
                        <td>${item.childrenStr}</td>
                        <td>${item.code}</td>
                        <td>${item.sortOrder}</td>
                        <td>${item.categoryStatus.value}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/categories/editCategory?lv=1&id=${item.id}"
                               class="btn btn-sm btn-link btn-block">编辑一级分类</a>
                            <a href="${pageContext.request.contextPath}/categories/categories/lv2?parentId=${item.id}"
                                    class="btn btn-sm btn-link btn-block">二级分类列表</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>

</div>

<script>
    $(document).ready(function(){

    });
</script>